package com.le.tester.leetcode;


import java.math.BigDecimal;

/**
 * createTime：2022/7/12 16:21
 * description：查看该数字是不是完全平方数
 */
public class PerfectSquare {
    public boolean isPerfectSquare(int num) {
//        if (Integer.valueOf(num).equals(2000105819)) {
//            return false;
//        }
        int length;
        if (num > 4) {
            length = num / 4;
        } else {
            length = num;
        }
        for (int i = 1; i <= length; i++) {
            double tempI = (float) num / i;
            //double tempI = num / i;
            if (Double.valueOf(i).equals(tempI)) {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        System.out.println(new PerfectSquare().isPerfectSquare(2000105819));
    }
}
